<import file="block/common.html" name="url"/>
<div class="layui-fluid">
    <div class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label required">角色</label>
            <div class="layui-input-inline">
					<select name="gid" lay-verify="required" lay-reqtext="角色不能为空">
					<?php foreach ($groupList as $key=>$vo){?>
					  <option value="<{$vo['id']}>" <?php if($info['gid'] == $vo['id']){echo "selected";}?>><{$vo['groupname']}></option>
					<?php }?>   
					</select>  
			</div>
        </div>
		<div class="layui-form-item">
            <label class="layui-form-label required">用户登录名</label>
            <div class="layui-input-inline">
                <input type="text" name="username" lay-verify="required" lay-reqtext="用户登录名不能为空" placeholder="请输入用户登录名" value="<{$info['username']}>" class="layui-input">
            </div><tip>必须为 字母或者 字母和数字组合，数字不能放在第一个字</tip>
        </div>
		<div class="layui-form-item">
            <label class="layui-form-label required">真实姓名</label>
            <div class="layui-input-inline">
                <input type="text" name="nickname" lay-verify="required" lay-reqtext="昵称不能为空" placeholder="请输入昵称" value="<{$info['nickname']}>" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-inline">
			<input type="text" name="password" value="" class="layui-input">			
            </div><tip>不修改密码可以为空</tip>
        </div>
		<div class="layui-form-item">
			<label class="layui-form-label">状态</label>
			<div class="layui-input-inline">
			  <input type="radio" name="status" value="1" title="启用" <?php if($info['status'] == 1){echo 'checked';}?>>
			  <input type="radio" name="status" value="0" title="禁用" <?php if($info['status'] == 0){echo 'checked';}?>>
			</div>
		  </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
			<input type="hidden" name="id" value="<{$info['id']}>">
                <button class="layui-btn" lay-submit lay-filter="saveBtn"><?php echo lang('save');?></button>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['form', 'table'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table,
            $ = layui.$;

        form.render();

        //监听提交
        form.on('submit(saveBtn)', function (data) {
			$.post('<{caUrl("adminuser","edit")}>',data.field,function(res){
                if(res.status == 1){
                    layer.msg(res.info, {icon: 1, time: 1000},function(){
						loadMain('<{caUrl("adminuser","index")}>');
					});
                }else{
                    layer.msg(res.info, {icon: 2, anim: 6, time: 5000});
                }
            });
            return false;
        });

    });
</script>